package psn.hui.sys.listener;

import javax.servlet.ServletContext;
import javax.servlet.ServletContextEvent;
import javax.servlet.ServletContextListener;
import javax.servlet.annotation.WebListener;

@WebListener
public class AppListener implements ServletContextListener{

	@Override
	public void contextDestroyed(ServletContextEvent sce) {
		
	}

	@Override
	public void contextInitialized(ServletContextEvent sce) {
		//取得ServletContext
		ServletContext context = sce.getServletContext();
		context.setAttribute("ctx", context.getContextPath());
		System.out.println("******** Servlet容器创建成功 ctx 被放到ServletContext作用域 ************");
	}

}
